<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
  <style type="text/css"> 
<!-- 
a:link { 
font-size: 14px; 
color: #000000; 
text-decoration: none; 
} 
a:visited { 
font-size: 14px; 
color: #000000; 
text-decoration: none; 
} 
a:hover { 
font-size: 14px; 
color: #999999; 
text-decoration: underline; 
} 
--> 
</style>

  </head>
  <% 
  Class.forName("com.mysql.jdbc.Driver").newInstance(); 
String url="jdbc:mysql://localhost:3306/graduatedesign";  
String user="root";  
String password="root"; 
String title="";
String content="";
Connection conn2 = DriverManager.getConnection(url, user, password); 
Statement sm2=conn2.createStatement();
ResultSet rs2=sm2.executeQuery("select distinct dept from dept");
%>
  <body>
    <form  name="f1" method="post" action="deptadd" onsubmit="return ck()">
						<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#BBD3EB">
                          	<tr>
                            	<td height="27" align="center" background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">部门名</td>
                            	<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<input type="text" id="dept" name="dept" size="50" value=""/></td>
    						</tr>
                         	<tr>
                            	<td height="27" align="center" background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">隶属部门</td>
                            	<td bgcolor="#FFFFFF">&nbsp;&nbsp;
                            	
                            	<select name=upper id=f2>
                               <% 
                               while(rs2.next()){%>
                                <option value='<%=rs2.getString(1)%>'><%=rs2.getString(1)%></option>
                               <% } %> 
                                  </select>
    						</tr>
    						<tr>
                            	<td height="27" align="center" background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">所在楼层</td>
                            	<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<input type="text" id="floor" name="floor" size="50" value=""/></td>
    						</tr>
    						<tr>
                            	<td height="27" align="center" background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">部门描述</td>
                            	<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<textarea rows="" cols="" name="des" id="des"></textarea>
									<script  language=javascript src="/OA/fckeditor/fckeditor.js"></script>
								</td>
    						</tr>
    						<tr>
    							<td height="27" align="center" background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF"></td>
    							<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<input type="submit" value="提交"/><input type="reset" value="重置"/></td>
    						</tr>
    						<script language="javascript">
                              function ck(){
                            	if(f1.dept.value==""){
                            		alert("部门名不能为空");
                            		return false;
                            	}
                            	alert("操作成功");
                            }
                            </script>
 </table>      
</form> 
  </body>
</html>
